﻿/***********************************************************************
 * <copyright file="RefType.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   LinhMC
 * Email:    linhmc@buca.vn
 * Website:
 * Create Date: Tuesday, October 22, 2013
 * Usage: 
 * 
 * RevisionHistory: 
 * Date    25/10/2013     Author  tuanhm             Description 
 * 
 * ************************************************************************/

using BusinessObjects.BusinessRules;

namespace BusinessObjects.BussinessDictionary
{
    /// <summary>
    ///     Class that holds information about a RefType
    /// </summary>
    public class RefType : BusinessObject
    {
        /// <summary>
        /// </summary>
        public RefType()
        {
            //validateId
            AddRule(new ValidateId("RefTypeId"));
            //validateRequired
            AddRule(new ValidateRequired("Name"));
            AddRule(new ValidateRequired("IsActive"));
            //validateLength
            AddRule(new ValidateLength("Name", 0, 255));
            AddRule(new ValidateLength("Description", 0, 255));
        }

        /// <summary>
        /// </summary>
        /// <param name="refTypeId"></param>
        /// <param name="name"></param>
        /// <param name="masterTable"></param>
        /// <param name="detailTable"></param>
        /// <param name="description"></param>
        /// <param name="isActive"></param>
        public RefType(int refTypeId, string name, string masterTable, string detailTable, string description,
                       bool isActive)
            : this()
        {
            RefTypeId = refTypeId;
            MasterTable = masterTable;
            Name = name;
            DetailTable = detailTable;
            Description = description;
            IsActive = isActive;
        }

        /// <summary>
        /// </summary>
        public int RefTypeId { get; set; }

        /// <summary>
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// </summary>
        public string MasterTable { get; set; }

        /// <summary>
        /// </summary>
        public string DetailTable { get; set; }

        /// <summary>
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// </summary>
        public bool IsActive { get; set; }
    }
}